/**/
//判断是否为空（为空设置为0）
const isnum = (value) =>{
    if(value){
        return value
    }
    else{
        return '0'
    }
}
/*比较时间*/
const changeDate = (value) =>{
    // value ='2017-12-25 18:20:11'
    var a = new Date();
    var b = new Date(value);
    a = a.valueOf();
    b = b.valueOf();
    var c = a - b;
    c = new Date(c);
    // alert(c.getFullYear() - 1970 + '年' + (c.getMonth()) + '个月' + (c.getDate()-1) + '天' + (c.getHours()-8) + '个小时' + c.getMinutes() + '分钟' + c.getSeconds() + '秒');
    if(c.getFullYear() - 1970>0){
        return c.getFullYear() - 1970 + '年前'
    }else if(c.getMonth() >0){
        return c.getMonth() + '月前'
    }else if(c.getDate()-1 >0){
        return c.getDate()-1 + '天前'
    }else if(c.getHours()-8 >0){
        return c.getHours()-8 + '小时前'
    }else if(c.getMinutes() >0){
        return c.getMinutes() + '分钟前'
    }else if(c.getSeconds() >0){
        return c.getSeconds() + '秒前'
    }



    return
}
export {
    isnum,
    changeDate,

}